<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <style>
      .imgdiv {
        width: 224px;
        height: 160px;
        border: 1px #ccc solid;
        display: inline-block;
        margin: 10px auto;
        margin-right: 100px;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>

    <script>
      // var my_mixin = {
      //   created: function() {
      //     console.log("混入对象的钩子被调用");
      //   }
      // };

      // var app = new Vue({
      //   el: "#app",
      //   mixins: [my_mixin],
      //   created: function() {
      //     console.log("组件钩子被调用");
      //   }
      // });

      Vue.mixin({
        methods: {
          sayHello: function() {
            console.log("hello");
          }
        }
      });

      var app = new Vue({
        el: "#app",
        created() {
          this.sayHello()
        },
        methods: {
          sayHello: function() {
            console.log("12454");
          }
        }
      });

      // app.sayHello();

      console.log(
        (function() {
          console.log(1);

          setTimeout(function() {
            console.log(2);
          }, 1000);

          setTimeout(function() {
            console.log(3);
          }, 0);

          setTimeout(function() {
            console.log(4);
          }, 0);

          console.log(5);
        })()
      );

      // 1 5 undefined 3 4 2
    </script>
  </body>
</html>
